﻿using System.Drawing;
using System.Windows.Forms;
using DataAccessLayer;

namespace Editor
{
    public partial class ProtagonistEditForm : Form
    {
        public readonly Protagonist Protagonist;

        public ProtagonistEditForm(Protagonist protagonist)
        {
            InitializeComponent();

            Protagonist = protagonist;
        }

        private void canvas_Paint(object sender, PaintEventArgs e)
        {
            if (Protagonist == null || string.IsNullOrEmpty(Protagonist.TextureName))
                return;

            Image img = Image.FromFile(Protagonist.TextureName);

            PointF pos = new PointF(canvas.Width, canvas.Height);

            pos.X -= img.Width*0.5f;
            pos.Y -= img.Height*0.5f;

            e.Graphics.DrawImage(img, pos);
        }

        private void saveToolStripMenuItem_Click(object sender, System.EventArgs e)
        {
            DialogResult = DialogResult.OK;
            Close();
        }
    }
}
